package com.example.demo.controller;

import com.example.demo.common.ResponseMessage;
import com.example.demo.service.IGoodService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/product/")
public class GoodController {
        @Autowired
        private IGoodService iGoodService;
        @RequestMapping("list.do")
        public ResponseMessage list(@RequestParam(defaultValue = "") String keyword,@RequestParam(defaultValue = "0") int categoryId,@RequestParam(defaultValue = "1") int pageNum, @RequestParam(defaultValue = "10") int pageSize){
            return iGoodService.getGoodsList(keyword,categoryId,pageNum,pageSize);
        }
        @RequestMapping("detail.do")
        public ResponseMessage detail(int productId){
            return iGoodService.getGoodDetail(productId);
        }
    }
